$(function(){
	$(".ding").ncDiggClick();//顶
	$(".cai").ncTrashClick();//踩
	$(".digg-hover").hover(function(){
		this.style.background = 'url("/images/ding_hover.png") no-repeat scroll 0 0 transparent';
	},function(){
		this.style.background = 'url("/images/ding.png") no-repeat scroll 0 0 transparent';
	});
	$(".trash-hover").hover(function(){
		this.style.background = 'url("/images/cai_hover.png") no-repeat scroll 0 0 transparent';
	},function(){
		this.style.background = 'url("/images/cai.png") no-repeat scroll 0 0 transparent';
	});
	$("#waiiframe").css({ width:'100%',height:'100%'});//alert($(window).height()+'px');
	$("#waiiframe").css({height:($(window).height() - 50)+'px'});
	
});
//顶
$.fn.ncDiggClick = function(){
	return this.each(function(){
		$(this).bindAfterLogin('click',function(){
			var $this = $(this);
			$ajax('/actions/digg',{'dc':this.id},function(json){
				$this[0].style.background = 'url("/images/ding.png") no-repeat scroll 0 0 transparent';
				$this.text(json.info).unbind('click').removeClass('digg-hover');
				$this.parent().find('.trash-hover').unbind().css('background','url("/images/cai.png") no-repeat scroll 0 0 transparent').removeClass('trash-hover');
			});
		});
	});
}
//踩
$.fn.ncTrashClick = function(){
	return this.each(function(){
		$(this).bindAfterLogin('click',function(){
			var $this = $(this);
			$ajax('/actions/trash',{'tr':this.id},function(json){
				$this[0].style.background = 'url("/images/cai.png") no-repeat scroll 0 0 transparent';
				$this.text(json.info).unbind('click').removeClass('trash-hover');
				$this.parent().find('.digg-hover').unbind().css('background','url("/images/ding.png") no-repeat scroll 0 0 transparent').removeClass('digg-hover');
			});
		});
	});
}